Skip to content

Conversation

@karur4n
Copy link

@karur4n karur4n commented Oct 27, 2025

⚠️ BREAKING CHANGE

This PR introduces a breaking change that requires the region parameter when using the Terminal Cloud API.

Summary

  • Add mandatory region validation for TerminalCloudAPI initialization
  • Throw a clear error message when region is not specified
  • Update all tests to include region parameter
  • Add new test cases to verify region validation behavior

Why this change?

The Terminal Cloud API endpoints are region-specific, and the library already supports multiple regions (EU, AU, US, APSE). However, the region parameter was optional, which could lead to:

  • Runtime errors when the wrong endpoint is used
  • Confusion about which endpoint is being called
  • Potential issues with region-specific features

Making the region parameter mandatory at initialization time provides:

  • ✅ Clear error messages at construction time (fail-fast)
  • ✅ Explicit regional endpoint configuration
  • ✅ Better developer experience with early validation

Breaking Change Details

Before (v30.0.0)

const client = new Client({
  apiKey: "YOUR_API_KEY",
  environment: EnvironmentEnum.TEST
});

const terminalAPI = new TerminalCloudAPI(client); // This was allowed

After (this PR)

import { RegionEnum } from '@adyen/api-library';

const client = new Client({
  apiKey: "YOUR_API_KEY",
  environment: EnvironmentEnum.TEST,
  region: RegionEnum.EU  // ⚠️ Now required for Terminal API
});

const terminalAPI = new TerminalCloudAPI(client); // ✅ Works

- Add validation to require region parameter when initializing TerminalCloudAPI
- Throw clear error message when region is not specified
- Add tests to verify region validation behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@karur4n karur4n force-pushed the feature/terminal-api-region-validation branch from b36b637 to 246cc3b Compare October 27, 2025 10:22
@karur4n karur4n changed the title feat: Add region validation for Terminal Cloud API feat!: add region validation for Terminal Cloud API Oct 27, 2025
@karur4n karur4n marked this pull request as ready for review October 27, 2025 10:39
@karur4n karur4n requested review from a team as code owners October 27, 2025 10:39
@karur4n karur4n marked this pull request as draft October 27, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant